package aaa.schedule.parameters;

import aaa.main.R;
import aaa.screen.CreateScheduleScreen;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 *
 * @author Seb
 */
public class ScheduleRessourceTitle extends ParameterType {
	
	public static final String FIELD_ID = "ressources_title" ;
	
	private LayoutInflater inflater;
	protected CreateScheduleScreen cs ;

	/**
	 * @param inflater
	 */
	public ScheduleRessourceTitle(LayoutInflater inflater, CreateScheduleScreen cs) {
		super(FIELD_ID);
		this.inflater = inflater;
		this.cs = cs ;
	}

	public Object getValue(View view) {
		return null ;
	}

	public View getView(View convertView, ViewGroup parent) {
		convertView = this.inflater.inflate(R.layout.type_schedule_reference_title, null) ;
		TextView text = (TextView) convertView.findViewById(R.id.add_ressource) ;
		text.setOnClickListener(new AddRessourceListener(this.cs)) ;
		return convertView ;
	} 
	
	class AddRessourceListener implements OnClickListener {	
		
		protected CreateScheduleScreen cs ;
		
		/**
		 * @param cs
		 */
		public AddRessourceListener(CreateScheduleScreen cs) {
			super();
			this.cs = cs;
		}


		public void onClick(View v) {
			this.cs.addResource() ;
		}
	}

}
